<template>
	<view>
		<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">报告查询</block>
		</cu-custom>
		<uni-search-bar placeholder="搜索任务编号" @confirm="search" @cancel="reload"></uni-search-bar>
		<scroll-view scroll-y class="page">
			<view style="height: 10rpx;"></view>
			<view v-if="dataList.length==0" class="no-data">未查询到数据</view>
			<!-- <Loadmore class="all" :style="{ height: wrapperHeight + 'px' }" :topMethod="loadTop" @topMethods="loadTop" :bottomMethod="loadBottom" @bottomMethods="loadBottom"  :bottomAllLoaded="allLoaded" :autoFill="false" :controlBottom="controlBottom" ref="loadmore" :top="top" :bottom="bottom"> -->
			<view v-for="data in dataList" class="cu-list menu card-menu margin-bottom-xl shadow-lg radius " style="background-color: #fff;">
				<view class="u-header"><text class="tips">报告编号:</text><text class="val">{{data.reportCode}}</text></view>
				<view class="u-body">
					<view class="row">
						<view class="tips">任务编号</view>
						<view class="val">{{data.taskCodes}}</view>
					</view>
					<view class="row">
						<view class="tips">样品编号</view>
						<view class="val">{{data.sampleCodes}}</view>
					</view>
				</view>
				<view class="u-footer">
					<view class="btn2" @tap="selectItem(data)">预览</view>
				</view>
			</view>
			<!-- </loadmore> -->
		</scroll-view>
	</view>
</template>

<script>
	// import Loadmore from '@/components/sjpeter-loadmore/loadmore.vue'
	import uniSearchBar from '@/components/uni-search-bar/uni-search-bar.vue';
	export default {
		data() {
			return {
				dataList: [],
				allLoaded: false,
				controlBottom: true,
				pageNum: 1,
				wrapperHeight: 0,
				bottom: 0,
				top: 0,
				param: {
					page: 1,
					limit: 1000,
					taskCode: '',
					status: '504'
				}
			}
		},
		components: {
			// Loadmore
			uniSearchBar
		},
		onShow: function() {
			this.loadData('');
		},
		methods: {
			reload(e){
				this.loadData('');
			},
			search(e){
				this.loadData(e.value);
			},
			selectItem:function(o){
				uni.setStorageSync("AUDIT_DATA",o);
				uni.navigateTo({
					url:'../../pages/audit/report_audit'
				})
			},
			loadData: function(c) {
				uni.request({
					url: this.$http + '/biz/bizReport/list?status=504&page=1&limit=10000&taskCode='+c,
					header: {
						token: uni.getStorageSync("token")
					},
					method: 'POST',
					success: (res) => {
						if (res.statusCode == 200 && res.data.code == 0) {
							this.dataList = res.data.page.list;
						} else {
							uni.showToast({
								icon: 'none',
								title: '查询数据失败，请重试！'
							});
						}
					},
					fail: function() {
						uni.showToast({
							icon: 'none',
							title: '服务器请求超时！'
						});
					}
				})
			}
		}
	}
</script>
<style>
	.no-data {
		text-align: center;
	}
</style>
